package com.pinapel.aixml.controller;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;

import com.pinapel.aixml.models.Model;
import com.pinapel.aixml.ui.LogInfoVerboseUI;
import com.pinapel.aixml.ui.TabbedLogUI;

public class TabbedLogController implements ILogInfoController{

	private IMainController mTopController;
	private LogInfoVerboseController mLogInfo;
	
	private TabbedLogUI mView;
	
	public TabbedLogController(IMainController controller){
		mTopController = controller;
		mLogInfo = new LogInfoVerboseController(this);
	}

	public TabbedLogUI getView(){
		return mView;
	}
	
	public void setView(TabbedLogUI view){
		mView = view;
		mView.setController(this);
		assingViewsToControllers();
	}
	
	@Override
	public IMainController getMainController() {
		return mTopController.getMainController();
	}

	@Override
	public Model getModel() {
		return mTopController.getModel();
	}

	@Override
	public void setInfoText(String s) {
		mLogInfo.setInfoText(s);
	}

	@Override
	public String getInfoText() {
		return mLogInfo.getInfoText();
	}

	@Override
	public RSyntaxTextArea getInfoTextArea() {
		// TODO Auto-generated method stub
		return mLogInfo.getInfoTextArea();
	}
	
	private void assingViewsToControllers(){
		mLogInfo.setView(mView.getInfoVerboseUI());
	}
}
